/*
    This file is part of Starlight Engine.

    Starlight Engine is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    Starlight Engine is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Starlight Engine.  If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using StarlightEngine;

namespace StarlightEngine
{
    /// <summary>
    /// The engines base object, all game objects are derived.
    /// </summary>
    public class SpriteNode : Node
    {          
        /// <summary>
        /// Initializes a new instance of the <see cref="Node"/> class.
        /// </summary>
        /// <param name="texture">The texture.</param>
        public SpriteNode(string texture)
        {
            this.Texture = texture;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Node"/> class.
        /// </summary>
        /// <param name="texture">The texture.</param>
        /// <param name="position">The position.</param>
        public SpriteNode(string texture, Vector2 position)
        {
            this.Texture = texture;
            this.Position = position;
        }


        /// <summary>
        /// Updates this instance.
        /// </summary>
        public override void Update()
        {
            //TODO
            //What is needed?
        }

        /// <summary>
        /// Draws this instance.
        /// </summary>
        public override void Draw()
        {
            Engine.SpriteBatch.Draw(this.TextureObject,this.Rectangle,null,this.DrawColor,this.Rotation,this.Origin,SpriteEffects.None,.5f);
        }

        protected override void CreateRectangle()
        {
            Rectangle = new Rectangle((int)Position.X, (int)Position.Y, (int)(TextureObject.Width * Scale), (int)(TextureObject.Height * Scale));
            //base.CreateRectangle();
        }
        
    }
}